import 'package:flutter/widgets.dart';

import '../../resource/language/generated/l10n.dart';

mixin DialogData {}

typedef DialogBtnPressedFunction = Future<bool> Function();

class TextWithHorizontalBtnDialogData with DialogData {
  final String title;
  final String desc;
  late String leftBtnText;
  late String rightBtnText;
  DialogBtnPressedFunction? onLeftBtnPress;
  DialogBtnPressedFunction? onRightBtnPress;

  TextWithHorizontalBtnDialogData(
      {required this.title,
      required this.desc,
      String? leftBtnText,
      String? rightBtnText,
      this.onLeftBtnPress,
      this.onRightBtnPress}) {
    this.leftBtnText = leftBtnText ?? T.current.cancel;
    this.rightBtnText = rightBtnText ?? T.current.surer;
  }
}

class TextWithCheckDialogData with DialogData {
  final String title;
  final String desc;
  late String positiveBtnText;
  late String negativeBtnText;
  final bool checked;
  late String checkDesc;
  final ValueSetter<bool>? checkSetter;
  DialogBtnPressedFunction? onNegativeBtnPress;
  DialogBtnPressedFunction? onPositiveBtnPress;

  TextWithCheckDialogData(
      {required this.title,
      required this.desc,
      String? negativeBtnText,
      String? positiveBtnText,
      this.onNegativeBtnPress,
      this.onPositiveBtnPress,
      this.checked = true,
      String? checkDesc,
      this.checkSetter}) {
    this.negativeBtnText = negativeBtnText ?? T.current.cancel;
    this.positiveBtnText = positiveBtnText ?? T.current.surer;
    this.checkDesc = checkDesc ?? T.current.remind_not_agin;
  }
}

class TextWithOneBtnDialogData with DialogData {
  final String title;
  final String desc;
  late String btnText;
  DialogBtnPressedFunction? onBtnPress;
  Widget? descWidget;

  TextWithOneBtnDialogData(
      {required this.title,
      required this.desc,
      String? btnText,
      this.descWidget,
      this.onBtnPress}) {
    this.btnText = btnText ?? T.current.surer;
  }
}

class TextWithVerticalBtnDialogData with DialogData {
  final String title;
  final String desc;
  late String firstBtnText;
  late String secondBtnText;
  DialogBtnPressedFunction? onFirstBtnPress;
  DialogBtnPressedFunction? onSecondBtnPress;
  Widget? descWidget;

  TextWithVerticalBtnDialogData(
      {required this.title,
      required this.desc,
      String? firstBtnText,
      String? secondBtnText,
      this.descWidget,
      this.onFirstBtnPress,
      this.onSecondBtnPress}) {
    this.firstBtnText = firstBtnText ?? T.current.surer;
    this.secondBtnText = secondBtnText ?? T.current.cancel;
  }
}

class PicTextWithVerticalBtnDialogData with DialogData {
  String imgAsset;
  final String title;
  final String desc;
  late String firstBtnText;
  late String secondBtnText;
  DialogBtnPressedFunction? onFirstBtnPress;
  DialogBtnPressedFunction? onSecondBtnPress;
  Widget? descWidget;

  PicTextWithVerticalBtnDialogData(
      {required this.title,
      required this.desc,
      String? firstBtnText,
      String? secondBtnText,
      this.onFirstBtnPress,
      this.onSecondBtnPress,
      this.descWidget,
      this.imgAsset = "assets/images/ic_dialog_top_default.png"}) {
    this.firstBtnText = firstBtnText ?? T.current.surer;
    this.secondBtnText = secondBtnText ?? T.current.cancel;
  }
}
